<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="pandoc" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  <title>README for COMP1721 Coursework 1</title>
  <style>
    html {
      line-height: 1.5;
      font-family: Georgia, serif;
      font-size: 20px;
      color: #1a1a1a;
      background-color: #fdfdfd;
    }
    body {
      margin: 0 auto;
      max-width: 36em;
      padding-left: 50px;
      padding-right: 50px;
      padding-top: 50px;
      padding-bottom: 50px;
      hyphens: auto;
      word-wrap: break-word;
      text-rendering: optimizeLegibility;
      font-kerning: normal;
    }
    @media (max-width: 600px) {
      body {
        font-size: 0.9em;
        padding: 1em;
      }
    }
    @media print {
      body {
        background-color: transparent;
        color: black;
        font-size: 12pt;
      }
      p, h2, h3 {
        orphans: 3;
        widows: 3;
      }
      h2, h3, h4 {
        page-break-after: avoid;
      }
    }
    p {
      margin: 1em 0;
    }
    a {
      color: #1a1a1a;
    }
    a:visited {
      color: #1a1a1a;
    }
    img {
      max-width: 100%;
    }
    h1, h2, h3, h4, h5, h6 {
      margin-top: 1.4em;
    }
    h5, h6 {
      font-size: 1em;
      font-style: italic;
    }
    h6 {
      font-weight: normal;
    }
    ol, ul {
      padding-left: 1.7em;
      margin-top: 1em;
    }
    li > ol, li > ul {
      margin-top: 0;
    }
    blockquote {
      margin: 1em 0 1em 1.7em;
      padding-left: 1em;
      border-left: 2px solid #e6e6e6;
      color: #606060;
    }
    code {
      font-family: Menlo, Monaco, 'Lucida Console', Consolas, monospace;
      font-size: 85%;
      margin: 0;
    }
    pre {
      margin: 1em 0;
      overflow: auto;
    }
    pre code {
      padding: 0;
      overflow: visible;
    }
    .sourceCode {
     background-color: transparent;
     overflow: visible;
    }
    hr {
      background-color: #1a1a1a;
      border: none;
      height: 1px;
      margin: 1em 0;
    }
    table {
      margin: 1em 0;
      border-collapse: collapse;
      width: 100%;
      overflow-x: auto;
      display: block;
      font-variant-numeric: lining-nums tabular-nums;
    }
    table caption {
      margin-bottom: 0.75em;
    }
    tbody {
      margin-top: 0.5em;
      border-top: 1px solid #1a1a1a;
      border-bottom: 1px solid #1a1a1a;
    }
    th {
      border-top: 1px solid #1a1a1a;
      padding: 0.25em 0.5em 0.25em 0.5em;
    }
    td {
      padding: 0.125em 0.5em 0.25em 0.5em;
    }
    header {
      margin-bottom: 4em;
      text-align: center;
    }
    #TOC li {
      list-style: none;
    }
    #TOC a:not(:hover) {
      text-decoration: none;
    }
    code{white-space: pre-wrap;}
    span.smallcaps{font-variant: small-caps;}
    span.underline{text-decoration: underline;}
    div.column{display: inline-block; vertical-align: top; width: 50%;}
    div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
    ul.task-list{list-style: none;}
    .display.math{display: block; text-align: center; margin: 0.5rem auto;}
  </style>
  <!--[if lt IE 9]>
    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  <![endif]-->
</head>
<body>
<h1 id="comp1721-coursework-1">COMP1721 Coursework 1</h1>
<ul>
<li><a href="#using-gradle">Using Gradle</a></li>
<li><a href="#tests-and-style-checking">Tests &amp; Style Checking</a></li>
<li><a href="#activecases-application">ActiveCases Application</a></li>
<li><a href="#chart-application">Chart Application</a><br />
</li>
<li><a href="#cleaning-up">Cleaning Up</a></li>
<li><a href="#submitting">Submitting</a></li>
</ul>
<h2 id="using-gradle">Using Gradle</h2>
<p>Everything you need to do in this assignment, aside from editing code, is handled by the Gradle build system. You can run Gradle from the command line, or use it from within VS Code or IntelliJ IDE if you prefer (see below).</p>
<p><strong>You do not need to install Gradle yourself</strong>, as we’ve included a ‘Gradle wrapper’ that will download a compatible version of the tool, along with various library dependencies, if required. <strong>This will be very slow the first time that it runs!</strong></p>
<p>You should run Gradle commands in the <code>cwk1</code> directory. On Linux and macOS, use <code>./gradlew</code>. On Windows, use <code>gradlew</code>. (The commands below assume the use of Linux or macOS.)</p>
<p>The different coursework artifacts are organised into separate projects. You can list these projects with <code>./gradlew projects</code>. The project name needs to be included when running tasks within a specific project.</p>
<h3 id="if-using-visual-studio-code">If Using Visual Studio Code</h3>
<p>You can simplify the use of Gradle by installing the Gradle Tasks extension. This will add a Gradle button to the side bar. Clicking on this will active a panel in which you can see and run the Gradle tasks for the various projects.</p>
<h3 id="if-using-intellij-idea">If Using IntelliJ IDEA</h3>
<p><strong>Please use the most recent version of the IntelliJ, on your own PC. We do not support the use of older versions for the coursework, and may not be able to help you if you encounter problems.</strong></p>
<p>Use the <em>New Project</em> button to import <code>cwk1</code> as the project directory. After the project has been imported, you should be able to use the Gradle button on the right-hand edge of the IntelliJ window to active the Gradle tool window. From here you can access a hierarchical list of all the supported Gradle tasks. The main list entries you will need to use for the coursework are</p>
<pre><code>core/Tasks/verification/test
app/Tasks/application/run
app/Tasks/application/runNoArgs</code></pre>
<p>Note: once you’ve used one of these entries, IntelliJ will create a run configuration for it, allowing you to rerun it in future in a more convenient way.</p>
<h2 id="tests-and-style-checking">Tests and Style Checking</h2>
<p>To run all the unit tests, recompiling code where necessary, do</p>
<pre><code>./gradlew :core:test</code></pre>
<p>To run only the tests for the basic solution, do</p>
<pre><code>./gradlew :core:test --tests Basic</code></pre>
<p>Substitute <code>Full</code> for <code>Basic</code> in the above command to run only the tests for the full solution.</p>
<p>Test names and status (PASSED or FAILED) are listed in the terminal. A <strong>test report</strong> is also generated in HTML, containing detailed information about the tests and any failures that have occurred. You can access this by pointing your browser at <code>core/build/reports/tests/test/index.html</code>. We suggest you keep this page open in a browser tab, refreshing it as necessary, so that you always have full information available on test results.</p>
<p>Note that Gradle won’t normally rerun tests if they have all passed, unless you’ve changed something in your code. You can force it to recompile everything and rerun the tests using</p>
<pre><code>./gradlew :core:test --rerun-tasks</code></pre>
<p>To check coding style for <code>CaseRecord</code> and <code>CovidDataset</code>, do</p>
<pre><code>./gradlew :core:style</code></pre>
<p>If there are any style violations, you’ll see a count reported in the terminal window. A full report on the violations can be viewed by pointing your browser at <code>core/build/reports/checkstyle/main.html</code>.</p>
<p><strong>Treat this as a rough guide.</strong> Note that style checking is not exhaustive, and we may still penalise you on style grounds even if no violations are reported here. As with unit tests, Gradle normally won’t rerun the style check unless you change something in your code.</p>
<h2 id="activecases-application">ActiveCases Application</h2>
<p>You can check coding style for this application with</p>
<pre><code>./gradlew :app:style</code></pre>
<p>You can run the application like this:</p>
<pre><code>./gradlew :app:run</code></pre>
<p>This will use <code>datafiles/2020-daily.csv</code> as the input file and <code>datafiles/2020-active.csv</code> as the output file.</p>
<p>You can run the application without any command line arguments (e.g., to check that it issues a helpful error message) like so:</p>
<pre><code>./gradlew :app:runNoArgs</code></pre>
<p>You can create a redistributable version of the application with</p>
<pre><code>./gradlew :app:distZip</code></pre>
<p>This creates a Zip archive <code>app.zip</code>, in <code>app/build/distributions</code>. This Zip archive contains the compiled code for the core class library and application, bundled into a pair of JAR files, plus a shell script and batch file that can be used to run the program on Linux, macOS or Windows.</p>
<h2 id="chart-application">Chart Application</h2>
<p><em>Note, since this involves a GUI, you won’t be able to work on this with a ‘headless’ JDK - as would typically be used inside Windows Subsystem for Linux, for example.</em></p>
<p>You can check coding style for the chart application with</p>
<pre><code>./gradlew :chart:style</code></pre>
<p>You can run the chart application with</p>
<pre><code>./gradlew :chart:run</code></pre>
<p>This will run the program with <code>datafiles/2020-daily.csv</code> as a command line argument.</p>
<h2 id="cleaning-up">Cleaning Up</h2>
<p>To remove all files generated by the build process, use</p>
<pre><code>./gradlew clean</code></pre>
<h2 id="submitting">Submitting</h2>
<p>Your coursework solution must be submitted to Minerva <strong>and</strong> must also be tagged as a solution in your GitLab repository.</p>
<p>To generate your Minerva submission, do this:</p>
<pre><code>./gradlew submission</code></pre>
<p>This will produce a Zip archive named <code>cwk1.zip</code>, containing everything that you need to submit. <strong>You must then submit this manually to Minerva</strong>, using the link provided in the <em>Submit My Work</em> area.</p>
<p>The remaining steps depend upon the platform you are using.</p>
<h3 id="on-linux-or-macos">On Linux or macOS</h3>
<p>First, make sure that you’ve committed any outstanding changes to your repository. Check this with <code>git status</code>.</p>
<p>Next, cd to the top level of your repository and run the <code>finished</code> script:</p>
<pre><code>./finished cwk1</code></pre>
<p>This will push commits up to gitlab.com. It will also tag the most recent commit as the one that we should look at as your coursework solution.</p>
<h4 id="if-you-make-a-mistake">If you make a mistake…</h4>
<p>If you ran the <code>finished</code> script too early and need to make further changes to your solution, do this:</p>
<pre><code>./notfinished cwk1</code></pre>
<p>Then make and commit the necessary changes. You can then run the <code>finished</code> script again.</p>
<h3 id="on-windows">On Windows</h3>
<p>First, make sure that you’ve committed any outstanding changes to your repository. Check this with <code>git status</code>.</p>
<p>Next, cd to the top level of your repository and run the following Git commands:</p>
<pre><code>git push origin main
git tag -a cwk1 -m &quot;cwk1 solution&quot;
git push origin cwk1</code></pre>
<p>These commands will ensure that all your commits are available on gitlab.com, and that the most recent commit is tagged as your solution.</p>
<h4 id="if-you-make-a-mistake-1">If you make a mistake…</h4>
<p>If you ran the above commands too early and need to make further changes to your solution, do the following:</p>
<pre><code>git tag -d cwk1
git push origin :refs/tags/cwk1</code></pre>
<p>Then make and commit the necessary changes. After that, you will need to run the previous set of three Git commands again.</p>
</body>
</html>
